package cn.songtx.iot.config;


import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Slf4j
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    /*
     * 拦截配置
     * 设置例外
     * */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new JWTInterceptor())
                .addPathPatterns("/**")                       // 所有接口的验证
                .excludePathPatterns("/hello")                // 测试接口例外
                .excludePathPatterns("/sysUser/login")        // 登陆接口例外
                .excludePathPatterns("/sysUser/save");        // 注册接口例外
    }
}
